* 03_viz_acts is called by main to print figures
*-------------------------------------------------------------------------------
* SET GRAPH PARAMETERS
*-------------------------------------------------------------------------------
	
	global asize 	10-pt
	global lsize	8-pt

	global		axes ///
				ysc(lc(none)) ///
				xsc(lc(none)) ///
				xlab(, 	labc(gs10) tlc(gs10) ///
						tlw(medthick) ///
						labsize($asize )) ///
				ylab(,  labc(gs10) ///
						tlc(gs10) ///
						tlw(medthick) ///
						nogrid ///
						labsize($asize )) ///
				note("") ///
				legend(size($lsize )) ///
				plotregion(	lc(gs10) ///
							lw(medthick)) ///
				graphregion(margin(zero)) ///
				xti("")
				
				
				
	global		combine_opts ///
				imargin(zero) ///
				graphregion(margin(zero))
				
	
	graph set window fontface "Helvetica Bold"


	
	
*-------------------------------------------------------------------------------
* Figure 1 - N acts per year
*-------------------------------------------------------------------------------
	
	* Acts
	
		* Read in 5 yr rolling average data (see `cr_sch_acts`)
			
			sort year
			merge m:1 year using "${DV}mov_avg_acts.dta"
			drop _merge
			
			
			
		* Plot	
		
			tw	(hist year if sch == 1 ///
					, 	freq discrete ///
						fc(gs13) ///
						lw(vthin) ///
						lc(none)) ///
				(line mov_avg year if yr_tag == 1 ///
					, 	sort ///
						lp(solid) ///
						lw(medthick) ///
						lc(gs6)) ///
				, legend(order(	1	"No. of Parliamentary Acts" ///
									"titled with educat* or school*" ///
								2 	"Five-yr. moving Avg.") ///
						 pos(10) ///
						 ring(0)) ///
					xti("") ///
					$axes ///
					xlabel(1800(30)1920, angle(45)) ///
					aspect(1) ///
					ysize(3) ///
					xsize(3) ///
					graphregion(margin(zero))
			
			gr export "${VZ}00_text/fig_1.pdf", replace




*-------------------------------------------------------------------------------
* Figure 2 - Indicators of scientization
*-------------------------------------------------------------------------------		
		
	* 2a
			
		tw 	(line wst_agency year if year < 1914 & yr_tag ==1 ///
				, 	lc(black)) ///
			(line wst_census year if year < 1914 & yr_tag ==1 ///
				, 	lc(black) ///
					lp("..-")) ///
			(line wst_yrbkpub year if year < 1914 & yr_tag ==1 ///
				, lc(black)) ///
					, /// 
					$axes ///
					xlabel(1800(30)1920, angle(45) nogrid) ///
					ylab(, nogrid) ///
					xti("") ///
					yti() ///
					ti("A", place(w) span) ///
					legend(	order(	1 	"Nat'l. statistics" "agency" ///
									2 	"Nat'l. census" "ever conducted" ///
									3 	"Concurrent nat'l."  ///
										"popul. statistics" "yearbook") ///
							 pos(10) ///
							 ring(0) ///
							 bmargin(small) ///
							 size(8-pt) ///
							 region(lc(none) ///
									fcolor(none)) ///
							 symxsize(small) ///
							 keygap(*.5)) ///
					 aspect(1) ///
					 graphregion(margin(zero)) ///
					 xsize(3) ///
					 ysize(3) 
					
					
		gr save "${VZ}f2a.gph", replace
			
			
			
	* 2b
	
		tw	(line committees year if year < 1914 & yr_tag ==1 ///
				,	lc(black)) ///
			(line wst_n_confs_sci year if year < 1914 & yr_tag ==1 ///
				,	lc(black)) ///
			(line uk_n_unis year if year < 1914 & yr_tag ==1 ///
				,	lc(black) ///
					lp("..-")) ///
					, ///
					$axes ///
					xlabel(1800(30)1920, angle(45) nogrid) ///
					ylab(0(25)100, nogrid ) ///
					xti("") ///
					yti("") ///
					ti("B", place(w) span) ///
					legend(	order(	3 	"No. of UK universities" ///
									1 	"No. of active BAAS research" ///
										"committees" ///
									2 	"No. of international social" ///
										"scientific congresses" ///
										"worldwide") ///
							pos(10) ///
							ring(0) ///
							bmargin(small) ///
							region(color(none)) ///
							symxsize(medium) ///
							keygap(*.5)) ///
					aspect(1) ///
					xsize(3) ///
					ysize(3) 

					
		gr save "${VZ}f2b.gph", replace
		
			
			
	* 2c
	
		tw	(line soc_journals year if year < 1914 & yr_tag ==1 ///
				,	lp("..._")) ///
			(line stats_journals year if year < 1914 & yr_tag ==1 ///
				,	lp(solid)) ///
			(line wst_n_unis year if year < 1914 & yr_tag ==1 ///
				,	lp("-")) ///
					, ///
					$axes ///
					xlabel(1800(30)1920, angle(45) nogrid) ///
					ylab(, nogrid) ///
					xti("") ///
					yti("") ///
					ti("C", place(w) span) ///
					legend(	order(	2 	"No. of statistics journals in" ///
										"circulation" ///
									3 	"No. of universities in West" ///
									1 	"No. of social science" ///
										"journals in circulation") ///
							pos(10) ///
							ring(0) ///
							bmargin(small) ///
							region(color(none)) ///
							symxsize(medium) ///
							keygap(*.5)) ///
					aspect(1) ///
					xsize(3) ///
					ysize(3) 
			
			
		gr save "${VZ}f2c.gph",  replace
			
			
	* Combine 
	
		gr combine 	"${VZ}f2a.gph" ///
					"${VZ}f2b.gph" ///
					"${VZ}f2c.gph" ///
					, ///
					$combine_opts ///
					col(3) ///
					xsize(9) ///
					ysize(3.2) ///
					iscale(*1.5) ///
					xcommon
				
		graph export "${VZ}00_text/fig_2.pdf", replace
		
		 
					


*-------------------------------------------------------------------------------
* Figure 3 ylab(0(.2)1) /// 					graphregion(margin(zero)) ///
*-------------------------------------------------------------------------------

	* 3a
	
		tw 	(line wst_indpndnt year if year < 1914 & yr_tag ==1 ///
				,	lc(black)) ///
			(line wst_flag year if year < 1914 & yr_tag ==1 ///
				,	lc(black)) ///
					, /// 
					$axes ///
					xlab(1800(30)1920, angle(45) nogrid) ///
					ylab(0(.2)1, nogrid) ///
					xti("") ///
					yti() ///
					ti("A", place(w) span) ///
					aspect(1) ///
					xsize(3) ///
					ysize(3) ///
					legend(	order(	2 "Nat'l Flag" ///
									1 "Nat'l Independence") ///
							pos(5) ///
							ring(0) ///
							bmargin(small) ///
							size(8-pt) ///
							region(lc(none) ///
								   fcolor(none)) ///
							symxsize(small) ///
							keygap(*.5)) 
			
		gr save "${VZ}3a", replace
		
	
	
	* 3b
	
		cap drop imp_wst_sch_enrll_n
		gen imp_wst_sch_enrll_n = imp_wst_sch_enrll/100
		
		tw 	(line wst_ctznshp year if year < 1914 & yr_tag ==1 ///
				,	lc(black)) ///
			(line imp_wst_sch_enrll_n year if year < 1914 & yr_tag ==1 ///
				,	lc(black)) ///
					, /// 
					$axes ///
					xlabel(1800(30)1920, angle(45) nogrid) ///
					ylab(0(.2)1, nogrid) ///
					xti("") ///
					yti() ///
					ti("B", place(w) span) ///
					aspect(1) ///
					xsize(3) ///
					ysize(3) ///
					legend(	order(	1 "Nat'l Citizenship Law"  ///
									2 "Avg. Prim. Enrollment") ///
							pos(5) ///
							ring(0) ///
							bmargin(small) ///
							size(8-pt) ///
							region(lc(none) ///
								   fcolor(none)) ///
							symxsize(small) ///
							keygap(*.5)) 
					
			
		gr save "${VZ}3b", replace
		
		
		
	* 3c
	
		tw 	(line wst_bank year if year < 1914 & yr_tag ==1 ///
				,	lc(black)) ///
			(line wst_anthem year if year < 1914 & yr_tag ==1 ///
				,	lc(black) lp("..-")) ///
			(line wst_suffrage year if year < 1914 & yr_tag ==1 ///
				,	lc(black)) ///
					, /// 
					$axes ///
					xlabel(1800(30)1920, angle(45) nogrid) ///
					ylab(0(.2)1, nogrid) ///
					xti("") ///
					yti() ///
					ti("C", place(w) span) ///
					aspect(1) ///
					xsize(3) ///
					ysize(3) ///
					legend(	order(	2 "Nat'l Anthem" ///
									1 "Nat'l Bank" ///
									3 "Avg. Suffrage Ratio" ///
									) ///
							pos(10) ///
							ring(0) ///
							bmargin(small) ///
							size(8-pt) ///
							region(lc(none) ///
								   fcolor(none)) ///
							symxsize(small) ///
							keygap(*.5)) 
			
		gr save "${VZ}3c", replace
		
		
		
	* Combine 
	
		gr combine 	"${VZ}3a.gph" ///
					"${VZ}3b.gph" ///
					"${VZ}3c.gph" ///
					, ///
					$combine_opts  ///
					col(3)  ///
					xsize(9) ///
					ysize(3.2) ///
					iscale(*1.5) ///
					xcommon
				
					
		gr export "${VZ}00_text/fig_3.pdf", replace

		
		
	* clean up 
	
		local gphs : dir "${VZ}"  files "*.gph"
		foreach gph in `gphs' {
			erase "${VZ}`gph'"
		}
		
